<template>
	<div class="page-bg">
		<scroll-view class="goods-bg" @scroll="scrollGoods" @scrolltolower="businessLoading" scroll-y v-if="!roleType">
			<unicloud-db ref="bannerdb" v-slot:default="{data, loading, error, options}" collection="opendb-banner"
				field="_id,bannerfile,open_url,title,category_id" @load="onqueryload">
				<!-- 当无banner数据时显示占位图 -->
				<!-- <image v-if="!(loading||data.length)" class="banner-image" src="/static/uni-center/headers.png" mode="aspectFill" :draggable="false" /> -->

				<!-- <swiper v-else class="swiper-box" @change="changeSwiper" :current="current" indicator-dots>
					<swiper-item v-for="(item, index) in data" :key="item._id">
						<view class="swiper-item" @click="clickBannerItem(item)">
							<image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
						</view>
					</swiper-item>
				</swiper> -->

				<swiper class="swiper-height" autoplay interval="6000" circular>
					<swiper-item v-for="(item ,index) in data" :key="item._id">
						<view class="swiper-item" v-if="data.ad_id==null" @click="clickBannerItem(item)">
							<image class="slide-img" mode="widthFix" :src="item.bannerfile.url" />
						</view>
						<!-- <view class="" v-else>
							<ad-custom unit-id="adunit-818cd3d3bf3b880d"></ad-custom>
						</view> -->
						<!-- #ifdef MP-WEIXIN -->
						<view class="" v-else>
							<ad-custom unit-id="data.ad_id"></ad-custom>
						</view>
						<!-- #endif -->
						<!-- #ifdef APP-PLUS -->
						<view class="" v-else>
							<image v-if="!(loading||data.length)" class="banner-image"
								src="/static/uni-center/headers.png" mode="aspectFill" :draggable="false" />
						</view>
						<!-- #endif -->

					</swiper-item>
				</swiper>
			</unicloud-db>
			<view class="my-notice-bar">
				<uni-notice-bar show-icon scrollable text="uni-app 版正式发布，。" />
			</view>
			<!-- <div class="search-info">
				<div class="search-info-box">
					<input class="text" type="text" placeholder="输入关键字搜索店铺" v-model="keyword" />
					<view class="btn" @click="searchGoods">搜索</view>
				</div>
			</div> -->

			<div class="list-btn">
				<div class="btns-bg">
					<div class="btn-item" @click="goDetail(item)" v-for="(item, index) in menus" :key="index">
						<div>
							<img :src="item.icon" />
							<div>{{ item.name }}</div>
						</div>
					</div>
				</div>
			</div>
			<!-- #ifdef MP-WEIXIN -->
			<!-- 关注公众号组件 -->
			<official-account></official-account>
			<!-- #endif -->

			<div class="goods-list">
				<div v-for="(item,index) in goodsList" @click="goGoods(item)" :key="index">
					<div class="goods-item">
						<!-- <image v-if="item.storeHeadImage" :src="picServiceUrl+item.storeHeadImage+'?time='+item.updateTime"
						mode="widthFix"></image> -->
						<easy-loadimage v-if="item.storeHeadImage" loading-mode="spin-circle" mode="widthFix"
							:scroll-top="scrollTop" :image-src="picServiceUrl+item.storeHeadImage"></easy-loadimage>
						<div class="goods-flex">
							<div class="left">
								<div class="name">
									<div>{{item.storeName}}</div>
									<div class="label-info"
										v-if="item.businessAlipayMchid&&item.businessWechatMchid&&item.memberDiscount!=1">
										支持再花卡
									</div>
								</div>
								<!-- <div class="address">{{item.storeAddress}}</div> -->
								<div class="juli" v-show="item">
									{{item.subjectType}}
									<span v-if="item.distanceTencentKm">{{item.distanceTencentKm}}km</span>
								</div>
							</div>
							<!-- <div class="right" @click.stop="goOrder(item.id)"
								v-if="environment == 'weixin'&&item.businessAlipayMchid&&item.businessWechatMchid">
								<div class="btn">去买单</div>
							</div> -->
						</div>
					</div>
					<!-- #ifdef MP-WEIXIN -->
					<ad-custom unit-id="adunit-818cd3d3bf3b880d" v-if="(index+1)%5==0"></ad-custom>
					<!-- #endif -->

				</div>

			</div>
			<!-- <view class="f-no-more" style="margin-bottom: 100px;" v-if="!busMore">
				没有更多了~
			</view> -->
		</scroll-view>

		<view v-if="roleType">
			<view class="f-tabs">
				<view :class="state == 0?'active':''" @click="handleChange(0)">待处理</view>
				<view :class="state == 1?'active':''" @click="handleChange(1)">已完成</view>
			</view>
			<swiper class="order-scroll" :current="state" @change="bindSwiper">
				<block v-for="(item, index) in 2" :key="index">
					<swiper-item>
						<scroll-view class="order-scroll" scroll-y @scrolltolower="rollingLoading">
							<view class="order-items" @click="openOrderConfirm(item)" v-for="item,idx in orderList"
								:key="idx">
								<view class="head">
									<view class="title" v-if="item.sourceOfflineBusinessType==2">
										<view class="bus-name" v-if="item.remark.name">{{item.remark.name}}</view>
										<view class="bus-name" v-else>
											{{item.businessName}}-{{item.itemList[0].category.title}}
										</view>
										<view class="city" v-if="item.remark.city">
											{{item.remark.city}}-{{item.remark.modeType}}
										</view>
									</view>
									<view class="title" v-else>
										<span class="number">{{item.showId}}</span>
										<span v-if="item.remark.number">桌号{{item.remark.number}}</span>
									</view>
									<view class="state">
										{{item.state==1?'已完成':item.state==3||item.state==6?'进行中':'已退款'}}
									</view>
								</view>

								<view class="center-msg" v-if="item.state!=3&&item.state!=6">
									<view class="code-img" v-if="item.goodsNumber||item.goodsNumberImage.length">
										<view class="top-code">
											<view>
												取餐码：{{item.goodsNumber}}
											</view>
											<view class="right" v-if="item.goodsNumberImage"
												@click.stop="showHideImg(item,idx)">
												二维码<uni-icons :type="item.show?'top':'bottom'" size="16"
													color="#266fe2"></uni-icons>
											</view>
										</view>
										<view v-if="item.show">
											<image class="img" v-for="(pic,index) in item.goodsNumberImage" :key="index"
												@click="viewPic(picServiceUrl+pic)" :src="picServiceUrl+pic"
												mode="widthFix">
											</image>
										</view>
									</view>
									<view v-else>
										订单已完成
									</view>
								</view>

								<view class="center-msg" v-else>
									<view v-if="item.remark.phone">
										手机：{{item.remark.phone}}
									</view>
									<view v-if="item.remark.phone" class="link"
										@click.stop="copyInfo(item.remark.phone)">
										复制
									</view>
									<view v-if="item.remark.userNumer">
										户号：{{item.remark.userNumer}},地区：{{item.remark.cityInfo}}
									</view>
								</view>



								<view v-for="good,idkey in item.itemList" :key="idkey">
									<view class="row goods">
										<view>{{good.goodsName}}</view>
										<view>￥{{good.originalPrice/100}}</view>
									</view>
									<view class="row shuxing">
										<view>{{good.specificationName}}</view>
										<view style="color: #36b172;">X{{good.nums}}</view>
									</view>
								</view>
								<view class="row count">
									<view><span v-if="item.itemList">共{{item.itemList.length}}种</span></view>
									<view>合计￥{{item.originalPrice/100}}</view>
								</view>
								<view class="row price-df" v-if="item.sourceOfflineBusinessType==2&&item.discountPrice">
									（含再花卡代付￥{{item.discountPrice/100}})
								</view>

								<view class="other">下单时间：{{item.createTimeString_date}}</view>

								<view class="other-order">订单编号：{{item.orderNumber}}<text class="link"
										@click.stop="copyInfo(item.orderNumber)">复制</text></view>
							</view>
							<view class="f-no-more" style="margin-bottom: 100px;" v-if="!noMore">
								没有更多了~
							</view>
						</scroll-view>
					</swiper-item>
				</block>
			</swiper>

		</view>

		<uni-popup ref="orderConfirm">
			<view class="pop-info">
				<view class="title">
					<view>处理订单</view>
					<image src="/static/image/icon2/xx.png" @click="closeOrderConfirm()"></image>
				</view>
				<uni-forms :modelValue="formData" :label-width="100">
					<uni-forms-item label="取餐二维码">
						<uni-file-picker limit="5" style="color:grey" :imageStyles="imageStyles" file-mediatype="image"
							@select="selectPic" @delete="deletePic">
							选择
						</uni-file-picker>
					</uni-forms-item>
					<uni-forms-item label="取餐码" name="code">
						<uni-easyinput type="text" v-model="formData.code" maxlength="16" placeholder="取餐码/取消订单原因" />
					</uni-forms-item>
				</uni-forms>
				<view class="btn-confrm">
					<view @click="clickOrderConfirm(2)">
						取消订单
					</view>
					<view @click="clickOrderConfirm(0)">
						确定
					</view>
				</view>
			</view>
		</uni-popup>

	</div>
</template>

<script>
	const app = getApp();
	let isRepet = false;
	import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
	import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
	export default {
		components: {
			easyLoadimage,
			statusBar
		},
		data() {
			return {
				swiperList: [
					"https://zaihuayi.top/picture/static/homeSwiper1.png?v=1",
					'广告位',
					"https://zaihuayi.top/picture/static/homeSwiper2.png?v=1",
				],
				menus: [{
						name: "生活服务",
						icon: "/static/menus3.png",
						url: "./phone/phone",
						type: 3,
						typeId: 1,
					},
					{
						name: "吃炸鸡",
						icon: "/static/icon1.png",
						url: "./order/order",
						type: 2,
						typeId: "肯德基",
					},
					{
						name: "吃汉堡",
						icon: "/static/icon2.png",
						url: "./order/order",
						type: 2,
						typeId: "麦当劳",
					},
					{
						name: "喝咖啡",
						icon: "/static/icon9.jpg",
						url: "./order/order",
						type: 2,
						typeId: "星巴克",
					},
					{
						name: "看电影",
						icon: "/static/icon7.png",
						url: "",
						type: 0,
					},
					// {
					// 	name: "瑞幸",
					// 	icon: "/static/icon9.png",
					// 	url: "./order/order",
					// 	type: 2,
					// typeId: 9,
					// },
					{
						name: "去加油",
						icon: "/static/icon6.png",
						url: "./phone/phone",
						type: 3,
						typeId: 11,
					},

					// #ifdef MP-WEIXIN
					{
						name: "影音会员",
						icon: "/static/icon10.png",
						url: "./phone/phone",
						type: 3,
						typeId: 12,
					},
					{
						name: "住酒店",
						icon: "/static/icon4.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 0,
					},
					{
						name: "点外卖",
						icon: "/static/icon12.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 1,
					},
					{
						name: "要打车",
						icon: "/static/icon17.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 2,
					},
					{
						name: "加油代驾",
						icon: "/static/icon14.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 3,
					},
					{
						name: "变美玩乐",
						icon: "/static/icon11.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 4,
					},
					{
						name: "想购物",
						icon: "/static/icon16.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 5,
					},
					{
						name: "发快递",
						icon: "/static/icon13.png",
						url: "./thirdParty/thirdParty",
						type: 0,
						typeId: 6,
					},
					{
						name: "美团闪购",
						icon: "/static/icon15.png",
						url: "./thirdParty/thirdParty",
						type: 4,
						typeId: 7,
					},
					// #endif


				],
				roleType: null,
				state: 0,
				goodsList: null,
				picServiceUrl: app.globalData.picServiceUrl,
				location: null,
				orderList: [],
				thePage: 1,
				crrOrderItem: null,
				formData: {
					code: "",
					qrcode: ""
				},
				picPath: [],
				offlineBusinessList: [],
				noMore: true,
				isLogin: false,
				isRepeat: true,
				busMore: true,
				busPage: 1,
				sharId: null,
				keyword: '',
				environment: null,
				scrollTop: 500,
			};
		},
		onLoad(e) {
			if (e && e.state) {
				this.state = e.state;
				this.roleType = true;
				uni.setStorageSync("userRole", this.roleType)
			}
			if (e.userId) {
				uni.setStorageSync("USERIDH5", e.userId)
			}
			this.roleType = uni.getStorageSync('userRole');

			var info;
			//#ifdef  MP-WEIXIN
			info = decodeURIComponent(e.q);
			this.environment = "weixin"
			this.getGps();
			// #endif

			//#ifdef  MP-ALIPAY
			this.environment = "alipay"
			info = app.globalData.qrCode
			// this.getAlipayGps();
			this.getOfflineBusinessInfoList();
			// #endif
			if (info) {
				this.sharId = info.split('id=')[1];
			}

		},
		onShow() {
			this.roleType = uni.getStorageSync('userRole');
			this.getUser();
			if (this.roleType) {
				this.getOrderList();
			} else {
				this.getOfflineBusinessInfoList();
			}

			if (this.sharId) {
				this.binding();
			}
		},
		onPullDownRefresh() {
			this.getUser();
			if (this.roleType) {
				this.getOrderList();
			} else {
				this.getOfflineBusinessInfoList();
			}
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			/**
			 * banner加载后触发的回调
			 */
			onqueryload(data) {},
			changeSwiper(e) {
				this.current = e.detail.current
			},
			/**
			 * 点击banner的处理
			 */
			clickBannerItem(item) {
				// 有外部链接-跳转url
				/* if (item.open_url) {
					uni.navigateTo({
						url: '/uni_modules/uni-id-pages/pages/common/webview/webview?url=' + item.open_url +
							'&title=' + item.title,
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} */
				// 其余业务处理
				uni.navigateTo({
					// url: '/pages/qrCode/qrCode?id=123'
					url: '/pages/zhy_business_info/addOrEdit'
				})
			},
			onpullingdown(e) {
				console.log(e);
				this.showRefresh = true
				if (e.pullingDistance > 100) {
					this.refresh()
				}
			},
			getAlipayGps() {
				var that = this;
				my.getLocation({
					success: (res) => {
						that.location = res;
						console.log(res)
						that.getOfflineBusinessInfoList();
					},
					fail: (res) => {
						my.showAuthGuide({
							authType: 'LBS',
							success: (res) => {
								//shown为true时表示会显示权限引导弹窗，为false时表示用户已经授权
								if (res.shown) {
									my.openSetting({
										success: (res) => {
											console.log(res)
											if (res.authSetting.location) {
												that.getAlipayGps();
											} else {
												that.getOfflineBusinessInfoList();
											}

										}
									})
								}
							},
							fail: (error) => {
								my.alert({
									content: '调用失败：' + JSON.stringify(error),
								});
							},
						});
					}
				})
			},
			binding() {
				console.log(this.sharId)
				uni.request({
					url: app.globalData.serviceUrl +
						'/UserMiniProgramController/doBindUserCashCouponHelper',
					data: {
						key: uni.getStorageSync('userKey'),
						helper_id: this.sharId
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						console.log(res)
						var data = res.data;
						if (data.state == 2) {
							uni.navigateTo({
								url: '../login/index'
							});
						} else {
							uni.showModal({
								title: '提示',
								content: data.state == 1 ? "已共享红包，现在可以去帮花啦" : res.data.notice,
								confirmText: '我知道了',
								showCancel: false
							})
							this.sharId = null;
						}
					}
				});
			},
			goOrder(id) {
				uni.navigateTo({
					url: "../qrCode/qrCode?id=" + id
				})
			},
			copyInfo(info) {
				uni.setClipboardData({
					data: info + '',
					success(res) {
						uni.showToast({
							title: '复制成功'
						});
					}
				});
			},
			getUser() {
				var that = this;
				uni.request({
					url: app.globalData.serviceUrl + '/UserMiniProgramController/getUserInfo',
					data: {
						key: uni.getStorageSync('userKey')
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},

					success(res) {
						var data = res.data;
						if (data.state == 1) {
							that.isLogin = true;
							// that.setData({
							// 	userInfo: data.data,
							// 	businessInfo: data.data.offlineBusiness
							// });
						} else if (data.state == 2) {
							that.isLogin = false;
						}
					}
				});
			},
			clickOrderConfirm(type) {
				if (this.isRepeat) {
					this.isRepeat = false;
					setTimeout(() => {
						this.isRepeat = true;
					}, 1000)
					if (this.picPath.length) {
						this.uploadPic(0, type); //递归上传
					} else {
						this.reqOrder(type);
					}
				}

			},
			uploadPic(index, type) {
				uni.uploadFile({
					url: app.globalData.serviceUrl +
						'/UserMiniProgramController/doUploadDisposeImage',
					filePath: this.picPath[index],
					name: 'file',
					success: (uploadFileRes) => {
						if (!this.formData.qrcode) {
							this.formData.qrcode = uploadFileRes.data;
						} else {
							this.formData.qrcode += "," + uploadFileRes.data;
						}

						if (index == this.picPath.length - 1) {
							this.reqOrder(type);
						} else {
							this.uploadPic(index + 1, type);
						}
					}
				});
			},
			reqOrder(type) {
				uni.request({
					url: app.globalData.serviceUrl +
						'/UserMiniProgramController/doDisposeSelfSupportGoodsOrder',
					method: 'POST',
					data: {
						key: uni.getStorageSync('userKey'),
						order_id: this.crrOrderItem.id,
						dispose_way: type, //处理结果 0完成 1失败(不退款) 2失败(需退款)
						dispose_content: this.formData.code,
						dispose_image: this.formData.qrcode
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						this.closeOrderConfirm();
						this.formData.code = "";
						this.formData.qrcode = "";
						uni.showToast({
							title: res.data.notice,
							icon: 'none'
						});
						this.refreshList();
					}
				});
			},
			selectPic(res) {
				this.picPath.push(res.tempFilePaths[0]);

			},
			deletePic(res) {
				console.log(res)
				this.picPath.splice(res.tempFilePath, 1);
				console.log(this.picPath)
			},
			closeOrderConfirm() {
				this.$refs.orderConfirm.close();
			},
			openOrderConfirm(item) {
				if (item.state == 3 || item.state == 6) {
					if (item.sourceOfflineBusinessType == 1) {
						uni.showModal({
							title: '提示',
							content: '您确定此订单已完成？',
							success: (res) => {
								if (res.confirm) {
									uni.request({
										url: app.globalData.serviceUrl +
											'/UserMiniProgramController/doFinishOfflineBusinessGoodsOrder',
										method: 'POST',
										data: {
											key: uni.getStorageSync('userKey'),
											order_id: item.id,
											offline_business_id: item.businessId,
										},
										header: {
											'content-type': 'application/x-www-form-urlencoded'
										},
										success: (res) => {
											uni.showToast({
												title: res.data.notice,
												icon: 'none'
											});
											this.refreshList();
										}
									});
								}
							}
						});
					} else {
						this.crrOrderItem = item;
						this.$refs.orderConfirm.open('bottom')
					}
				}
			},
			getGps() {
				var that = this;
				uni.getLocation({
					type: 'gcj02',
					altitude: true,

					success(res) {
						that.location = res;
						that.getOfflineBusinessInfoList();
					},

					fail(ff) {
						//用户拒绝授权
						uni.getSetting({
							success: function(res) {
								if (!res.authSetting['scope.userLocation']) {
									uni.showModal({
										title: '提示',
										content: '拒绝授权位置信息，将无法获取您附近商家信息',
										confirmText: '去设置',

										success(res) {
											if (res.confirm) {
												uni.openSetting({
													success(res) {
														var info = res.authSetting;
														console.log(res)
														if (res.authSetting[
																'scope.userLocation'
															]) {
															that.getGps();
														}
													}
												});
											} else {
												if (res.cancel) {
													that.getOfflineBusinessInfoList();
												}
											}
										}
									});
								}
							}
						});
						uni.setStorage({
							key: 'location',
							data: {
								latitude: 0,
								//写入默认0，后台判断为空
								longitude: 0
							}
						});
					}
				});
			},
			refreshList() {
				this.thePage = 1;
				this.orderList = [];
				this.noMore = true;
				this.getOrderList();
			},
			handleChange(type) {
				if (this.state != type) {
					this.thePage = 1;
					this.orderList = [];
					this.state = type;
					this.noMore = true;
				}
			},
			searchGoods() {
				this.busPage = 1;
				this.getOfflineBusinessInfoList();
			},
			getOfflineBusinessInfoList() {
				var that = this;
				uni.request({
					url: app.globalData.serviceUrl +
						'/UserMiniProgramController/getOfflineBusinessInfoList',
					method: 'POST',
					data: {
						order_by: 1, // - 查询顺序 0 创建时间(默认) 1 经纬度距离
						order_by_clause: 0, // - 查询顺序方式 0 正序(默认) 1 倒序
						location_type: 1, // - 经纬度类型 0 高德(默认) 1 腾讯
						longitude: this.location ? this.location.longitude : "", // - 经度
						latitude: this.location ? this.location.latitude : "", // - 纬度
						type: 1, // - 类型 0 全部(默认) 1 正常 2 自营 3 自营不展示
						state: 2, // - 状态 0 全部 1 取消 / 删除 2 正常(默认)
						page: this.busPage, // - 当前页（ 可不传 默认第1页）
						page_size: 10, // - 页大小（ 可不传 默认20）
						keyword: this.keyword
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						let info = res.data.data;
						if (info && info.length) {
							if (this.busPage == 1) {
								this.goodsList = info
							} else {
								this.goodsList = this.goodsList.concat(info)
							}
						} else {
							this.busMore = false;
						}
					}
				});
			},
			scrollGoods(e) {
				this.scrollTop = e.detail.scrollTop;
			},
			businessLoading() {
				if (this.busMore) {
					this.setData({
						busPage: this.busPage + 1
					});
					this.getOfflineBusinessInfoList();
				}
			},
			rollingLoading() {
				if (this.noMore) {
					this.setData({
						thePage: this.thePage + 1
					});
					this.getOrderList();
				}
			},
			bindSwiper(e) {
				console.log(e)
				this.thePage = 1;
				this.orderList = [];
				this.state = e.detail.current;
				this.noMore = true;
				this.getOrderList();
			},
			getOrderList() {
				uni.request({
					url: app.globalData.serviceUrl +
						'/UserMiniProgramController/getOfflineBusinessUserOrderList',
					method: 'POST',
					data: {
						key: uni.getStorageSync('userKey'),
						//-1全部(默认) 0取消 1完成 2待支付 3待客服处理 4客服处理中 5处理失败 6待商家接单 7商家已接单 8商家取消接单 支持逗号分隔多个状态
						state: this.state == 0 ? '3,6' : '0,1,4,5,7,8',
						page: this.thePage
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						if (res.data.state == 1) {
							let info = res.data.data;
							for (let i in info) {
								if (info[i].remark) {
									try {
										info[i].remark = JSON.parse(info[i].remark);
									} catch (err) {
										info[i].remark = info[i].remark
									}
								}
								if (info[i].goodsNumberImage) {
									let arr = info[i].goodsNumberImage.split(",");
									info[i].goodsNumberImage = arr;
								}
								info[i].showId = "00" + info[i].id;
								let len = info[i].showId.length;
								info[i].showId = info[i].showId.substring(len - 4, len)
							}
							if (info && info.length) {
								if (this.thePage == 1) {
									this.orderList = info
								} else {
									this.orderList = this.orderList.concat(info)
								}
							} else {
								this.noMore = false;
							}

						}

					}
				});
			},
			goDetail(item) {
				if (item.type == 0) {
					return uni.showToast({
						title: "近期上线",
						icon: "none"
					})
				}
				if (!this.isLogin && item.type != 4) {
					return uni.navigateTo({
						url: "../login/index"
					})
				}

				if (item.type != 4) {
					var crrTime = new Date().getHours();
					if (crrTime < 9 || crrTime >= 21) {
						return uni.showToast({
							title: '当前非营业时间，营业时间为9:00-21:00',
							icon: 'none'
						});
					}
				}


				if (item.type == 1) { //啥也不用传 酒店
					uni.navigateTo({
						url: item.url
					});
				} else if (item.type == 2) { //传id坐标选店铺
					let url = item.url + '?id=' + item.typeId;
					if (this.location) {
						url += '&longitude=' + this.location.longitude +
							'&latitude=' +
							this.location.latitude
					}
					uni.navigateTo({
						url: url
					});
				} else if (item.type == 3) { //传typeId 手机充值、加油、开会员
					uni.navigateTo({
						url: item.url + '?id=' + item.typeId + '&name=' + item.name
					});
				} else if (item.type == 4) { //第三方  美团 饿了么
					uni.navigateTo({
						url: item.url + '?id=' + item.typeId
					});
				}




			},
			goGoods(item) {
				uni.navigateTo({
					url: "./goodsDetail/goodsDetail?item=" + JSON.stringify(item)
				});
			},
			goMenu(url) {
				uni.redirectTo({
					url: url
				});
			},
			viewPic(url) {
				uni.previewImage({
					urls: [url]
				})
			},
			showHideImg(item, index) {
				item.show = !item.show;
				this.orderList.splice(index, 1, item);
			}
		},
	};
</script>

<style scoped lang="scss">
	::v-deep .easy-loadimage {
		image {
			border-radius: 20rpx;
		}
	}

	.pop-info {
		background: #fff;
		border-top-left-radius: 10px;
		border-top-right-radius: 10px;
		padding: 15px;

		.title {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 20px;
			border-bottom: 1px solid #E2E2E2;
			padding-bottom: 10px;
			margin-bottom: 10px;

			image {
				width: 20px;
				height: 20px;
			}
		}

		.btn {
			color: #2979ff;
			line-height: 50px;
			border-bottom: 1px solid #E2E2E2;
		}

		.btn-confrm {
			display: flex;

			view {
				width: 120px;
				line-height: 35px;
				text-align: center;
				margin: 10px auto;
				background: #333;
				color: #fff;
			}
		}
	}

	.search-info {
		background: #fff;
		padding: 10px;

		.search-info-box {
			height: 30px;
			background: #F4F4F4;
			border-radius: 15px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 0 auto;
			padding-left: 20px;

			.text {
				flex: 1 1 0;
				font-size: 14px;
			}

			.btn {
				flex: 0 0 50px;
				text-align: center;
				font-size: 14px;
			}
		}
	}

	.goods-list {
		padding: 0 10px;

		.goods-item {
			background: #fff;
			margin: 15px 0;
			border-radius: 10px;
			position: relative;

			::v-deep .loading-img {
				height: 280px;
			}

			::v-deep .easy-loadimage {
				width: 100%;
				border-radius: 10px;

			}

			.label-info {
				display: inline-block;
				color: #fff;
				background: #333;
				padding: 3px 5px;
				font-size: 12px;
				border-radius: 5px;
				margin-left: 10rpx;
				font-weight: 400;
			}

			.goods-flex {
				display: flex;
				align-items: flex-end;
				padding: 0 10px 10px;

				.right {
					flex: 0 0 70px;

					.btn {
						height: 30px;
						line-height: 30px;
						text-align: center;
						border: 1px solid #333;
						border-radius: 5px;
						color: #fff;
						background: #333;
						font-size: 14px;
					}
				}

				.left {
					flex: 1 1 0;

					.name {
						font-size: 14px;
						font-weight: bold;
						margin: 5px 0;
						display: flex;
						align-items: center;
					}

					.address {
						font-size: 12px;
						color: #666;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
					}

					.juli {
						font-size: 12px;
						color: #666;

						span {
							margin-left: 15px;
						}
					}
				}
			}


		}
	}

	.page-bg {
		background: rgba(242, 243, 248, 1);
	}

	.goods-bg {
		height: 100vh;
		background: rgba(242, 243, 248, 1);
	}

	.swiper-height {
		height: 525rpx;
	}

	.slide-img {
		width: 100%;
	}

	.list-btn {
		width: 100%;
		margin: 15px 0;
	}

	.btns-bg {
		margin: 0 10px;
		background-color: #fff;
		box-shadow: 0px 3px 5px 0px rgba(207, 207, 207, 0.39);
		border-radius: 15px;
		padding: 20px 0;
	}

	.btn-item {
		width: 20%;
		text-align: center;
		display: inline-block;
		margin-bottom: 10px;
		font-size: 24rpx;
	}

	.btn-item img {
		width: 40px;
		height: 40px;
		object-fit: cover;
	}

	.btn-content {
		position: absolute;
		/* top: 405px; */
		/* top: 330px; */
		width: 100%;
	}

	.center-infos {
		margin: 0 10px;
		background-color: #fff;
		box-shadow: 0px 3px 5px 0px rgba(207, 207, 207, 0.39);
		border-radius: 15px;
		padding: 20px 0;
		display: flex;
		justify-content: space-around;
	}

	.swiperLevel {
		justify-content: space-around;
	}

	.level2 {
		text-align: center;
		border: 1px solid #888888;
		display: inline-block;
		border-radius: 15px;
		line-height: 20px;
		height: 20px;
		font-size: 12px;
		color: #000;
		background-color: #fff;
		padding: 15rpx;
		margin-right: 10rpx;
		margin-top: 20rpx;
	}

	.selected {
		border: 2px solid #111111;
	}

	.info-hongbao {
		width: 31%;
		text-align: center;
	}

	.info-hongbao img {
		width: 100%;
	}

	.info-hongbao view {
		background-color: #111;
		color: #fff;
		font-size: 12px;
		line-height: 25px;
		border-radius: 5px;
	}

	.good-info {
		padding: 10px;
	}

	.good-menu {
		display: flex;
		align-items: center;
		background-color: #fff;
		box-shadow: 0px 3px 5px 0px rgba(207, 207, 207, 0.39);
	}

	.good-menu view {
		width: 25%;
		text-align: center;
		font-size: 12px;
		line-height: 25px;
	}

	.good-menu .active {
		background-color: #222;
		color: #fff;
	}

	.not-movie {
		width: 100%;
	}

	.good-menu-list .good-menu-tabs {
		background: rgba(242, 243, 248, 1);
	}

	.goods-scroll {
		height: 100vh;
	}

	.good-menu-list.fix {
		position: sticky;
		top: 0;
		left: 0;
		z-index: 9999;
	}

	.menu-title {
		min-width: 60px;
		width: auto !important;
		padding: 0 5rpx;
	}

	.menu-size {
		font-size: 14px !important;
	}

	.top {
		width: 100%;
		background-color: rgba(242, 243, 248, 1);
		display: block;
	}

	.topsearch {
		width: 90%;
		margin-left: 5%;
		display: flex;
		padding: 4% 0 0 0;
		align-items: center;
	}

	.frame {
		background-color: white;
		width: 75%;
		border-radius: 40rpx;
		padding: 0 3%;

		border: 1px solid #3f3f3f;
	}

	.frame>input {
		font-size: 30rpx;
		margin: 6rpx 0;
		width: 75%;
		height: 50rpx;
		line-height: 50rpx;
	}

	.center {
		font-size: 30rpx;
	}

	.topsearch>text {
		width: 15%;
		margin-left: 5%;
		color: #fff;
		padding: 1.5% 3%;
		background-color: #000;
		border-radius: 40rpx;
		font-size: 34rpx;
		text-align: center;
	}

	.order-scroll {
		height: 88vh;
	}

	.order-items {
		margin: 10px;
		padding: 15px;
		background-color: #fff;
		box-shadow: 0px 3px 5px 0px rgba(207, 207, 207, 0.39);
		border-radius: 5px;

		.head {
			display: flex;
			align-items: center;
			justify-content: space-between;
			background: #f6f6f6;
			border-radius: 5px;

			.title {
				padding: 10px;
				font-size: 20px;

				.number {
					font-size: 42px;
					margin-right: 10px;
				}

				.city {
					font-size: 18px;
				}

				.bus-name {
					font-size: 18px;
				}
			}

			.state {
				line-height: 75px;
				width: 75px;
				border-left: 1px solid #e2e2e2;
				text-align: center;
				// color: #266fe2;
			}
		}

		.center-msg {
			background: #f1fcf6;
			color: #36b172;
			padding: 15px;
			margin: 20px 0;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.link {
				text-decoration: underline;
				color: #266fe2;
			}

			.code-img {
				width: 100%;

				.top-code {
					display: flex;
					align-items: center;
					justify-content: space-between;
					width: 100%;

					.right {
						font-size: 16px;
						color: #266fe2;
					}
				}

				.img {
					margin-top: 20px;
					width: 100%;
					background: #EEE;
				}
			}
		}


		.row {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 5px 0;
		}

		.count {
			margin-top: 20px;
		}

		.price-df {
			font-size: 14px;
			padding-bottom: 20px;
			border-bottom: 1px solid #e3e3e3;
			justify-content: flex-end;
		}

		.shuxing {
			color: #666;
		}

		.other {
			font-size: 14px;
			color: #666;
		}

		.other-order {
			font-size: 14px;
			color: #666;
			margin-top: 10px;

			.link {
				margin-left: 15px;
				text-decoration: underline;
				color: #266fe2;
			}
		}
	}

	.my-notice-bar {
		width: 95%;
		margin-left: 2%;
	}
</style>